#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>

typedef struct 
{
	int a;
	// int b;
} B_t;

typedef struct 
{
	int a;
	B_t *b;
	char c[8];
	char *d;
} A_t;

struct list_node
{
	struct list_node *next;
	struct list_node *prev;
};

struct ALL_STRUCT {
	int a;
	char b[16];
	char *c;
	A_t	d;
	struct B_t *e;
	void *f;
	bool has_fmapi;
	struct list_node entry;
	struct timespec last_resp_time;
};

int main()
{
	B_t b = {};
	b.a = 2;
	// b.b = 4;
	char d[] = "456";
	A_t t = {1, &b, "123", d};
	
	printf("%d %d\n", sizeof(t.a), offsetof(typeof(A_t), a));
	printf("%d %d\n", sizeof(t.b), offsetof(typeof(A_t), b));
	printf("%d %d\n", sizeof(t.c), offsetof(typeof(A_t), c));
	for(int i = 0; i < sizeof(t); i++) {
		printf("%02x ", ((unsigned char *) &t)[i]);	///< 这样输出字节的话，如果是指针，打印的是地址
	}
	printf("\n");
	for(int i = 0; i < strlen(t.d) + 1; i++) {		///< 如果是char *
		printf("%02x ", ((unsigned char *) t.d)[i]);
	}
	printf("\n");
	for(int i = 0; i < sizeof(*t.b); i++) {
		printf("%02x ", ((unsigned char *) t.b)[i]);
	}
	printf("\n");
	printf("0x%x \n", t.b);
	
	return EXIT_SUCCESS;
}
